package array;
import java.util.*;
public class TestArr2 {
	public static void main(String[] args) {
		int a[]={8,4,2,1,23,344,12};
		int sum=0;
		int num;
		int n=0;
		Scanner sc=new Scanner(System.in);
		for(int i=0;i<a.length;i++){
			sum+=a[i];
			System.out.printf("%4d",a[i]);
		}
		System.out.println();
		System.out.println("sum="+sum);
		num=sc.nextInt();
		for(int i=0;i<a.length;i++){
			if(a[i]==num){
				System.out.println(num+"  is in the array!");
				break;
			}
			n=i;
		}
		if(n>=a.length)
				System.out.println(num+"   is not in the array");
	}

}
